package mysql

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Account  string `gorm:"type:varchar(30)"`
	Password string `gorm:"type:varchar(32)"`
}

func (u *User) FindUser(db *gorm.DB, id uint) error {
	return db.Debug().Where("id=?", id).FirstOrCreate(&u).Error
}

func (u *User) FindUserId(db *gorm.DB, id uint) error {
	return db.Debug().Where("users.id=?", id).First(&u).Error
}
